import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter);

import Home from '../components/Home/Home.vue'
import Login from '../Login_components/Login/Login.vue'
import Waimai from '../components/Waimai/Waimai.vue'
import My from '../components/My/My.vue'
import Orders from '../components/Orders/Orders.vue'
import Sousuo from '../components/Sousuo/Sousuo.vue'
import Login_xinxi from '../Login_components/Login_xinxi/Login_xinxi.vue'
import Login_password from '../Login_components/Login_password/Login_password.vue'
import Myshop from '../components/Myshop/Myshop.vue'
import ShopGoods from '../components/Myshop/shop_Goods/ShopGoods.vue'
import ShoperInfo from '../components/Myshop/Shoper_Info/ShopInfo.vue'
import ShopRatings from '../components/Myshop/Shop_Ratings/ShopRatings.vue'

// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location, onResolve, onReject) {
//   if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
//   return originalPush.call(this, location).catch(err => err)
// }


export default new VueRouter({
    routes:[
        {path:'/', redirect: '/home/waimai'},
        {path:'/login', component:Login, redirect: '/login/xinxi', children:[
            {path:'/login/xinxi', component: Login_xinxi},
            {path:'/login/password', component: Login_password},
        ]},
        {path:'/home', component:Home, children:[
            {path:'/home/waimai', component: Waimai},
            {path:'/home/my', component: My},
            {path:'/home/orders', component: Orders},
            {path:'/home/sousuo', component: Sousuo}
        ]},
        {path: '/myshop', component:Myshop, redirect:'/myshop/shopgoods', children:[
            {path: '/myshop/shopgoods', component:ShopGoods},
            {path: '/myshop/shopinfo', component:ShoperInfo},
            {path: '/myshop/shopratings', component:ShopRatings},
        ]},
    ]
});